cd ""
clear 
set more off

use data_all_vars_outliers, replace	


* standardizing for comparability of coefficients and ease of comparison 
foreach var of varlist extrav consci neurot agree open SOEP_e SOEP_a SOEP_c SOEP_n SOEP_o LS_gen SWLS GPS* cognitive  q_mood_beginning_1 q_mood_end_1 cog_*   {
	sum `var' if `var'!=.
	replace `var'=(`var'-`r(mean)')/`r(sd)' if `var'!=.
	sum w2_`var' if w2_`var'!=.
	replace w2_`var'=(w2_`var'-`r(mean)')/`r(sd)' if w2_`var'!=.
	capture sum w1w2_`var' if w1w2_`var'!=.
	capture replace w1w2_`var'=(w1w2_`var'-`r(mean)')/`r(sd)' if w1w2_`var'!=.	
	}

*** normalize the reliability variables 
*** keep the non-normalized variables as weight_`var'
foreach var of varlist w1w2_sure_pers w1w2_reliable reliable sure_pers w2_reliable w2_sure_pers {
	gen weight_`var'=`var'
	sum `var' if `var'!=.
	replace `var'=(`var'-`r(mean)')/`r(sd)' if `var'!=.
	
	}

	
* all
global all ="extrav consci neurot agree open cognitive GPS_risk GPS_time GPS_pres_bias GPS_neg_rec_self GPS_neg_rec_self2 GPS_neg_rec_other GPS_alt  GPS_pos_rec GPS_trust"

******************************* Exhibits Start ************************************************************************************


**************** Below Generates Table 5
global controls ="male age i.country"	

local i=1
local j=1

foreach out of varlist college_grad GPA_pct unemp	LS_gen     {

		foreach list in  all {
		if `j'==1 {
			local j_cond "replace"
			}
		else local j_cond "append"
		
		local pre=""


		reg `out' ${`pre'`list'} $controls
		outreg2 using reg_outcomes_comp.xls, `j_cond' dec(2) noomitted

		
		reg `out' ${`pre'`list'} $controls if sure_high==0
		outreg2 using reg_outcomes_comp.xls, append dec(2) noomitted	

		reg `out' ${`pre'`list'} $controls if sure_high==1
		outreg2 using reg_outcomes_comp.xls, append dec(2) noomitted	
		

		
		local ++j
	
	}
}
